import db from '@/store/localstorage';
export default {
	namespaced: true,
	state: {
		token: db.get('USER_TOKEN'),
		expireTime: db.get('EXPIRE_TIME'),
		user: db.get('USER'),
		permissions: db.get('PERMISSIONS'),
		roles: db.get('ROLES')
	},
	mutations: {
		setToken(state: any, val: any) {
			db.save('USER_TOKEN', val);
			state.token = val;
		},
		setExpireTime(state: any, val: any) {
			db.save('EXPIRE_TIME', val);
			state.expireTime = val;
		},
		setUser(state: any, val: any) {
			db.save('USER', val);
			state.user = val;
		},
		setPermissions(state: any, val: any) {
			db.save('PERMISSIONS', val);
			state.permissions = val;
		},
		setRoles(state: any, val: any) {
			db.save('ROLES', val);
			state.roles = val;
		}
	}
};
